/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-05-04 09:13:10
 * @LastEditors: huangtianyang
 * @LastEditTime: 2023-10-07 09:59:32
 * @FilePath: \cxl-h5\src\apis\wallet\index.ts
 */
import { request as axios } from '@/axios/index'
/**
 * 获取充值套餐
 * @returns
 */
export const getPaySetMeal = () => {
    return axios({
        method: 'get',
        url: '/api/mall/store/package/findEnableNumberPackage'
    })
}

/**
 * 微信支付
 * @param openId 微信用户openId 通过微信用户信息获取接口获得
 * @param storePackageId 储值套餐Id
 * @param storeType 储值状态：1.储值充值；2.储值消费
 * @returns
 */
export const wxPay = (openId: string, storePackageId: string, storeType: number) => {
    return axios({
        method: 'post',
        url: '/api/mall/portal/store/order/create/wx',
        data: {
            openId,
            storePackageId,
            storeType
        }
    })
}

interface paramsType {
    current: number //当前页
    size: number //每页数量
    companyId?: string //企业id
}

/**
 * 充值记录
 * @param params
 * @returns
 */
export const getPayRecordList = (params: paramsType) => {
    return axios({
        method: 'get',
        url: '/api/mall/trade/record/store-order-list',
        params
    })
}
/**
 * 退款记录
 * @param params
 * @returns
 */
export const getRefundRecordList = (params: paramsType) => {
    return axios({
        method: 'get',
        url: '/api/mall/trade/record/refund-list',
        params
    })
}
/**
 * 消费记录
 * @param params
 * @returns
 */
export const getConsumeRecordList = (params: paramsType) => {
    return axios({
        method: 'get',
        url: '/api/mall/trade/record/report-order-list',
        params
    })
}
